home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 385 / prg_1 / prg_1ap.s < prev    next >
Text File  |  1985-11-19  |  3KB  |  63 lines

  1.  ; Program Name: PRG_1AP.S
  2.  ;      Version: 1.001
  3.  
  4.  ; Assembly Instructions:
  5.  
  6.  ;    1. Assemble in AssemPro PC-relative mode and save the assembled
  7.  ;       program with a PRG extension, then save it with a TOS extension.
  8.  
  9.  ;    2. Click on the PC-relative option under the Assembler menu to activate
  10.  ;       the Absolute assembly mode.  The Absolute mode is active when there
  11.  ;       is no check mark in front of the PC-relative option and no check mark
  12.  ;       in front of the Relocatable option.  Change the name of the source
  13.  ;       file to PRG_1AA.  Do this by clicking on the File option under the
  14.  ;       File menu and, in the dialog box that appears, backspace over the
  15.  ;       letter P and type an A.  Do not save the new source file, but
  16.  ;       assemble it and save the assembled program with a PRG extension,
  17.  ;       then save it with a TOS extension.
  18.  
  19.  ;    3. Click on the Relocatable option under the Assembler menu.
  20.  ;       Change the name of the source file to PRG_1AR.  Do not save the
  21.  ;       source file, but assemble in the Relocatable mode and save with
  22.  ;       PRG and TOS extensions.
  23.  
  24.  ; Program Function:
  25.  
  26.  ;    This program invokes a single GEMDOS function.  That function performs
  27.  ; three services.  It relinquishes processor control, prohibits execution
  28.  ; beyond the program's upper boundary and removes the program from ram.
  29.  
  30.  ; Program Purpose:
  31.  
  32.  ;    To introduce the smallest possible ST program.  Every ST program must
  33.  ; accomplish at least two functions.  It must relinquish processor control,
  34.  ; and it must prevent execution beyond its boundaries.  Processor control
  35.  ; must be relinquished at some time during the life of each program, if for
  36.  ; no other reason, then because all programs must eventually finish the
  37.  ; task for which they were invoked.  Without some sort of demarcating code
  38.  ; within an executing program, the processor will continue to try to execute
  39.  ; whatever is in memory, until a fatal error eventually occurs. 
  40.  
  41.  ;    GEMDOS function $0, also known as (aka) p_term_old, term or terminate,
  42.  ; may be invoked to perform these two functions.  But, in addition, this
  43.  ; function also removes the program from memory.   
  44.  
  45.  ;    When GEMDOS $0 is invoked, processor control is returned to the 
  46.  ; agent that initiated the execution of the program that is now invoking
  47.  ; GEMDOS $0.  That agent may be the Desktop or some other program.
  48.  
  49.  ;    An additional purpose of this exercise is to compare the sizes of
  50.  ; the code files produced by the three assembly modes.  Furthermore, if
  51.  ; you are able to carefully observe the length of time it takes to execute
  52.  ; each type of program, where the mode of assembly indicates "type", you
  53.  ; will see that the time required to execute the Relocatable types is longer
  54.  ; than the time required to execute the other types.
  55.  
  56. terminate:                       ; My descriptive label.
  57.  move.w    #0, -(sp)             ; Function = p_term_old = GEMDOS $0.
  58.  trap      #1                    ; GEMDOS call.
  59.  end                             ; Assembler pseudo-op.
  60.  
  61.  
  62.